package com.xxwu.springiocdi.Component;

import com.xxwu.springiocdi.dao.User;
import com.xxwu.springiocdi.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
public class UserComponent {
    // 通过 Autowired 注入依赖
    @Autowired
    private UserService userService;

    // 通过构造函数注入

    public void sayHi() {
        System.out.println("sayHi, Component");
        userService.sayHi();
    }
}
